﻿<%--<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<CRM.Models.TrainingsCourses>" %>--%>
<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<CRM.Database.Model.TrainingsCourses>" %>
<%@ Import Namespace="System.Drawing" %>
<%@ Import Namespace="CRM.Resourses" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    Редактировать учебный курс
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">

<h2>Редактировать учебный курс</h2>

<%using (Html.BeginForm("TrainingsCoursesEdit", "TC", FormMethod.Post, new { @class = "edit_form" }))
  //using (Html.BeginForm("TrainingsCoursesEdit", "TC"))
      {
          Html.ValidationSummary(true);
      %>
      <%: Html.Hidden("IdTrainingsCourse")%> 
      
      <%
          var rubricsCol = new CRM.Database.Model.RubricsCollection();
      %>

      <table>
        <tr>
            <td>
                <%:Html.DevExpress().Label(settings =>
                  {
                      settings.ControlStyle.CssClass = "lable";
                      settings.Text = "Название курса";
                      settings.AssociatedControlName = "Name";
                      settings.Width = 604;
                  }).GetHtml() %>
          
                <%:Html.DevExpress().TextBox(settings =>
                  {
                      settings.Name = "Name";
                      settings.ControlStyle.CssClass = "editor";
                      settings.Width = 604;
                  }).Bind(Model.Name).GetHtml()%>
            </td>
        </tr>
      </table>
      
      <table>
        <tr>
            <td>
                <%:Html.DevExpress().Label(settings =>
                  {
                      settings.ControlStyle.CssClass = "lable";
                      settings.Text = "Рубрика";
                      settings.AssociatedControlName = "IdRubric";
                      settings.Width = 300;
                  }).GetHtml()%>
                <%: Html.DevExpress().ComboBox(settings =>
                  {
                      settings.Name = "IdRubric";
                      settings.ControlStyle.CssClass = "editor";
                      settings.Properties.TextField = "NameRu";
                      settings.Properties.ValueField = "IdRubric";
                      settings.Properties.ValueType = typeof (int);
                      settings.Width = 300;
                  }
              ).BindList(rubricsCol.RubricsActiveList).Bind(Model.IdRubric).GetHtml()%>
              <%--).BindList(DB.Rubrics.ToList()).Bind(Model.IdRubric).GetHtml()%>--%>
            </td>
            <td>
                <%Html.RenderPartial("TrainingsCoursesTrainersEditPartial"); %>
            </td>  
        </tr>
        <tr>
            <td>
                <%Html.RenderPartial("TrainingsCoursesPlasesEditPartial"); %>
            </td>
            <td>
                <%Html.RenderPartial("TrainingsCoursesAuditoriumsEditPartial"); %>
            </td>  
        </tr>
        <tr>
            <td>
                <%:Html.DevExpress().Label(settings => 
                    {
                        settings.ControlStyle.CssClass = "label";
                        settings.Text = "Допустимое кол-во участников:";
                        settings.AssociatedControlName = "ParticipantCount";
                        settings.Width = 300;
                    }).GetHtml()%>
                <%:Html.DevExpress().SpinEdit(settings =>
                    {
                        settings.Name = "ParticipantCount";
                        settings.ControlStyle.CssClass = "editor";
                        settings.Width = 300;
                    }).Bind(Model.ParticipantCount).GetHtml()%>
            </td>
            <td>
                <%:Html.DevExpress().Label(settings => 
                    {
                        settings.ControlStyle.CssClass = "label";
                        settings.Text = "Длительность:";
                        settings.AssociatedControlName = "Duration";
                        settings.Width = 300;
                    }).GetHtml()%>
                <%:Html.DevExpress().SpinEdit(
                    settings =>
                    {
                        settings.Name = "Duration";
                        settings.ControlStyle.CssClass = "editor";
                        settings.Properties.DisplayFormatString = "N1";
                        settings.Properties.Increment = (decimal)0.5;
                        settings.Width = 300;
                    }).Bind(Model.Duration).GetHtml()%>
            </td>  
        </tr>
        <tr>
            <td>
                <%:Html.DevExpress().Label(settings =>
                    {
                        settings.ControlStyle.CssClass = "lable";
                        settings.Text = "Описание";
                        settings.AssociatedControlName = "Description";
                        settings.Width = 300;
                    }).GetHtml() %>
                <%:Html.DevExpress().TextBox(settings =>
                    {
                        settings.Name = "Description";
                        settings.ControlStyle.CssClass = "editor";
                        settings.Width = 300;
                    }).Bind(Model.Description).GetHtml()%>
            </td>
            <%--<td>
                <%:Html.DevExpress().Label(settings =>
                    {
                        settings.ControlStyle.CssClass = "lable";
                        settings.Text = "Тип курса";
                        settings.AssociatedControlName = "IdTrainingCoursesType";
                        settings.Width = 300;

                    }).GetHtml()%>
                <%: Html.DevExpress().ComboBox(settings =>
                    {
                        settings.Name = "IdTrainingCoursesType";
                        settings.ControlStyle.CssClass = "editor";
                        settings.Properties.TextField = "NameRu";
                        settings.Properties.ValueField = "IdTrainingCoursesType";
                        settings.Properties.ValueType = typeof (int);
                        settings.Width = 300;
                    }).BindList(DB.TrainingCoursesTypesActive).Bind(Model.IdTrainingCoursesType).GetHtml()%>
            </td>  --%>
        </tr>
        <tr>
            <td>
                <%Html.RenderPartial("TrainingsCoursesTypesEditPartial"); %>
            </td>
        </tr>
      </table>
      
      <%: Html.DevExpress().CheckBox(
          settings =>
          {
              settings.Name = "IsActive";
              settings.ControlStyle.CssClass = "checkEditor";
              settings.Text = Resourses.IsActive;
          }).Bind(Model.IsActive).GetHtml() %>
      
      <div class="line">
      
      
          <%Html.DevExpress().Label(settings =>
                  {
                      settings.ControlStyle.CssClass = "label";
                  }).GetHtml(); %>
        
        <table>
            <tr>
                <td>
                    <%Html.DevExpress().Button(settings =>
                      {
                          settings.Name = "btnUpdate";
                          settings.ControlStyle.CssClass = "button";
                          settings.Text = Resourses.ButtonApply;
                          settings.UseSubmitBehavior = true;
                      }).GetHtml();%>
                </td>
                <td>
                    <%Html.DevExpress().Button(settings =>
                      {
                          settings.Name = "btnCancel";
                          settings.ControlStyle.CssClass = "button";
                          settings.Text = Resourses.ButtonCancel; ;
                          settings.ClientSideEvents.Click = "function(s, e){ document.location='" +
                                                            DevExpressHelper.GetUrl(
                                                                new { Controller = "TC", Action = "TrainingsCoursesList" }) + "'; }";
                      }).GetHtml();%>
                </td>
            </tr>
        </table>
          
       </div>
  <% } %>
</asp:Content>
